This LINQ ran perfectly on my machine. It passed code review. It shipped. And then, with real data, it quietly started pulling thousands of rows into memory on every page load.
csharp.GroupBy(m => m.ThreadId)
.Select(g => g.OrderByDescending(m => m.CreatedDate).First())
One line. Let me show you exactly why — and the two-line fix.
This LINQ ran perfectly on my machine. It passed code review. It shipped. And then, with real data, it quietly started pulling thousands of rows into memory on every page load.
csharp.GroupBy(m => m.ThreadId)
.Select(g => g.OrderByDescending(m => m.CreatedDate).First())
One line. Let me show you exactly why — and the two-line fix.
We're using the Anthropic Claude API as our LLM brain. You can swap this for OpenAI, Gemini, or any local LLM with minor changes. we'll build a minimal but **real** AI Agent in a C# .NET Console app that:
1. Takes a user goal
2. Thinks about what tool to use
3. Calls the tool
4. Observes the result
5. Loops until done — or knows it's finished
We're using the Anthropic Claude API as our LLM brain. You can swap this for OpenAI, Gemini, or any local LLM with minor changes. we'll build a minimal but **real** AI Agent in a C# .NET Console app that:
1. Takes a user goal
2. Thinks about what tool to use
3. Calls the tool
4. Observes the result
5. Loops until done — or knows it's finished